const trimQuery = (ctx) => {
  const query = ctx.query;
  if (query) {
    Object.keys(query).forEach((key) => {
      query[key] = query[key].trim();
    });
  }
};

const requestFormat = () => async (ctx, next) => {
  trimQuery(ctx);
  await next();
};

module.exports = requestFormat;
